package 面向对象.goods;

import java.util.Random;
import java.util.Scanner;

public class CarTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Car[] arr = new Car[3];
        for (int i = 0; i < arr.length; i++) {

            Car c = new Car();

            System.out.println("请输入第" + (i + 1) + "辆车的品牌：");
            String brand = sc.next();
            c.setBrand(brand);
            System.out.println("请输入第" + (i + 1) + "辆车的颜色：");
            String color = sc.next();
            c.setColor(color);
            System.out.println("请输入第" + (i + 1) + "辆车的价格：");
            double price = sc.nextDouble();
            c.setPrice(price);

            arr[i] = c;
        }

        for (int i = 0; i < arr.length; i++) {
            Car car = arr[i];
            System.out.println(arr[i].getBrand() + "， " + arr[i].getColor() + "， " + arr[i].getPrice());
        }
    }
}
